#include <windows.h>
#include <list>
#include <tchar.h>
using namespace std;
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_CommHdr.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_Types.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_ProtocolHdr.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_Core/NetCore_Define.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_Core/NetCore_Error.h"

//g++ -std=gnu++11 -Wall -g Test_UDPSelect.cpp -o Test_UDPSelect -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core -lNetEngine_BaseLib -lNetEngine_Core -Wl,-rpath=../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core,--disable-new-dtags

int main()
{
    XNETHANDLE xhToken = 0;
    if (!NetCore_UDPSelect_Init(&xhToken, 5000))
    {
        printf("NetCore_UDPSelect_Init:%lX\n", NetCore_GetLastError());
        return 0;
    }
    while (1)
    {
        int nMsgLen = 2048;
        TCHAR tszMsgBuffer[2048];
        TCHAR tszClientAddr[64];

        memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
        memset(tszClientAddr, '\0', sizeof(tszClientAddr));

        NetCore_UDPSelect_Recv(xhToken, tszClientAddr, tszMsgBuffer, &nMsgLen, TRUE);
        Sleep(1000);
    }
    return TRUE;
}
